<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class FlowModel extends BaseModel
{
    protected $table = 'flow';
    public $timestamps = false;
    protected $guarded = [];

    public function SaveFlow($uuid,$sid,$cid)
    {
        $res = FlowModel::create([
            'uid' => $uuid,
            'sid' => $sid,
            'cid' => $cid,
            'created_at' => date('Y-m-d H:i:s'),
        ]);

        if($res){
            return ['code' => true,'data' => 1];
        }else{
            return ['code' => true,'data' => 0];
        }
    }

    public function getFlow($cid)
    {
        $res = FlowModel::where('cid',$cid) -> count();

        if($res){
            return ['code' => true,'data' => $res];
        }else{
            return ['code' => true,'data' => 0];
        }
    }
}
